import sqlite3

# 创建或连接到一个数据库文件
conn = sqlite3.connect("iron.db")  # 如果文件不存在，会自动创建

# 创建一个游标对象
cursor = conn.cursor()

# 创建表
cursor.execute('''
CREATE TABLE IF NOT EXISTS db_info (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    host TEXT NOT NULL,
    user_name TEXT NOT NULL,
    password TEXT NOT NULL,
    database TEXT NOT NULL
)
''')

# # 插入数据
# cursor.execute("INSERT INTO users (name, age) VALUES (?, ?)", ("Alice", 25))
# cursor.execute("INSERT INTO users (name, age) VALUES (?, ?)", ("Bob", 30))
#
# # 提交事务
# conn.commit()
#
# # 查询数据
# cursor.execute("SELECT * FROM users")
# rows = cursor.fetchall()
# for row in rows:
#     print(row)

# 关闭连接
cursor.close()
conn.close()
